<template>
	<view class="team">
		<!-- <view class="team-title">
			<text class="label">
				直属代理商
			</text>
		</view> -->
		<view class="team-contain">
			<view class="title">
				<text>共计<text class="total">{{total}}</text>个结果</text>
				<!-- <view>入网时间</view> -->
			</view>
			<view class="item" v-for="(item,index) in list" :key="index" @click="itemHandel(item.id)">
				<view class="name">
					<text class="left">{{item.agentName}}</text>
					<text :class="['tag',{'tag-red':item.status==0}]">{{item.status==0?'未实名':'已实名'}}</text>
				</view>
				<view class="time">
					<view class="left">
						<text>代理商编号:{{item.agentNo}}</text>
						<text>注册时间:{{item.addDate}}</text>
					</view>
					<u-icon class="right" name="arrow-right" color="#666666" size="28"></u-icon>
				</view>
			</view>
		</view>
		<uni-load-more :status="loadMore"></uni-load-more>
	</view>
</template>

<script>
	import {
		listData,
	} from "@/api/agent";
	import loadMoreData from "@/mixins/loadmore";
	export default {
		mixins: [loadMoreData],
		data() {
			return {
				list: [],
				total: 2,
				queryParams: {
					agentType:0
				}
			}
		},
		onLoad() {
			this.getList();
		},
		methods: {
			getList() {
				let params = {
					pageNum: this.pageNum,
					pageSize: this.pageSize,
					...this.queryParams,
				};
				listData(params).then(res => {
					this.total = res.total;
					let list = res.rows;
					this.loadMoreStatusDeal(list);
					if (list.length > 0) {
						this.list = this.list.concat(list);
					}
				})
			},
			reachBottomCallBack() {
				this.getList();
			},
			init() {
				this.$nextTick(() => {
					this.list = [];
				});
			},
			itemHandel(id) {
				console.log(3)
				this.$nav.push({
					path: '/pages/home/myAgent/agentDetail',
					query: {
						id
					},
				});
			},
			onNavigationBarButtonTap(e) {
			    this.$nav.push({
			      path: "/pages/home/myAgent/addAgent",
			    });
			}
		}
	}
</script>

<style lang="scss">
	.team {
		margin: R(30);

		&-title {
			margin-bottom: R(20);

			.label {
				padding: R(10) R(20);
				background-color: #D9E7FF;
				border: 1px solid $themeColor;
				color: $themeColor;
				border-radius: R(30);
			}
		}

		&-contain {
			background-color: #FFFFFF;
			border-radius: R(10);
			padding: R(20) R(30);
			margin-top: R(30);

			.title {
				display: flex;
				justify-content: space-between;
				color: #737373;

				.total {
					color: #4286F5;
				}
			}

			.item {
				border-bottom: 1px solid #EEEEEE;
				margin: R(30) 0;

				.name {
					margin-top: R(20);
					margin-bottom: R(20);

					.left {
						font-weight: 600;
					}

					.tag {
						background-color: #E1EFFC;
						border-radius: R(30);
						border: 1px solid $themeColor;
						padding: R(5) R(20);
						color: $themeColor;
						margin-left: R(10);
						font-size: R(20);
					}

					.tag-red {
						background-color: #FFE8EA;
						border: 1px solid #FF0000;
						color: #FF0000;
					}
				}

				.time {
					color: #666666;
					display: flex;
					justify-content: space-between;
					align-items: center;
					margin-bottom: R(30);

					.left {
						display: flex;
						flex-direction: column;

						text {
							margin: R(10) 0;
						}
					}
				}

				&:last-child {
					border-bottom: 0;
				}
			}
		}
	}
</style>
